package com.chenfeng.wiki.controller;
import com.chenfeng.wiki.domain.Test;
import com.chenfeng.wiki.service.TestService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import  org.springframework.web.bind.annotation.RequestMapping;
import  org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class testcontroller {
    @Value("${test.hello:TEST}")
    private  String testHello;
    @GetMapping("/hello")
    public String hello()
    {return "hello world"+testHello;}

    @PostMapping("/hello/post")
    public String helloPost(String name) {
        return "hello world! post," + name ;
    }
    @Resource
    private TestService testService;
    @GetMapping("/test/list")
    public List<Test> list(){
        return testService.list();
    }

}

